package com.basker.pisces.redis.concurrent.lock;

import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;

import com.basker.pisces.concurrent.lock.AbstractLockManager;
import com.basker.pisces.concurrent.lock.ILock;

public class RedissonLockManager extends AbstractLockManager {

    @Autowired(required = false)
    private RedissonClient redissonClient;

    public RedissonLockManager(String name) {
        super(name);
    }

    public RedissonLockManager(String name, RedissonClient redissonClient) {
        super(name);
        this.redissonClient = redissonClient;
    }

    @Override
    protected ILock createLock(String key) {
        return new RedissonLock(key, redissonClient);
    }

}
